#define _CRT_SECURE_NO_WARNINGS
#pragma warning(disable:6031)

#include <stdio.h>

int main()
{
	int current = 0;
	int days = 0;
	int week[8] = { 0,250,250,250,250,250,0,0 };
	int s = 0;
	int i = 0;

	scanf("%d %d", &current, &days);

	for (i = 0; i < days; i++)
	{
		s += week[current];
		if (7 == current)
		{
			current = 1;
			continue;
		}
		current++;

	}

	printf("%d", s);

	return 0;
}